# -*- coding: utf-8 -*-

import time
from report import report_sxw
import pooler
from osv import osv
from tools.translate import _
import random
from datetime import datetime
import logging
        
class Parser(report_sxw.rml_parse):
    logging.getLoggerClass()
        
    def __init__(self, cr, uid, name, context):
        
        super(Parser, self).__init__(cr, uid, name, context=context)
        pool = pooler.get_pool(cr.dbname)
        self.gxn_obj = pool.get('ctsv.gxn.list')
        
        self.localcontext.update({
            'init': self._init,
            'name': self.get_gxn.name,
            'code': self.get_gxn.code,
            'date_birth': self.get_gxn.date_birth,
            'gov_id': self.get_gxn.gov_id,
            'tax_code': self.get_gxn.tax_code,
            'country_id': self.get_gxn.country_id,
            'gender': self.get_gxn.gender,
            'perm_addr': self.get_gxn.perm_addr,
            'tel': self.get_gxn.tel,
            'mobile': self.get_gxn.mobile,
            'email': self.get_gxn.email,
            'fax': self.get_gxn.fax,
            'cur_addr': self.get_gxn.cur_addr,
            'show_more_info': self.get_gxn.show_more_info,
            'receive_emails': self.get_gxn.receive_emails,
            'dept_id': self.get_gxn.dept_id.name,
            'gxn_id': self.get_gxn.gxn_id.id,
            'reason' : self.get_gxn.reason,
        })
    
    def _init(self, gxn):
        logging.info('----GXN ID : %s', gxn.id)
        self.gxn = self.gxn_obj.browse(self.cr, self.uid, gxn.id, context=False)
        return True

    def get_lines(self):
        return self.lines
    
    def get_gxn(self):
        return self.gxn
    
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
